package com.liu.test.controller;

//import com.liu.example.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 *  测试功能
 *
 */
@RestController
public class HelloController {

//    @Autowired
//    private HelloService helloService;
//
//    /**
//     *  SpringBoot-自动配置
//     *      EnableAutoConfiguration
//     */
//    @RequestMapping("/hello")
//    private String hello(){
//        return helloService.SayHello("张三");
//    }

    /**
     *  响应流只能使用1次
     *
     */
    @GetMapping("/getUser2")
    public void getUser(HttpServletResponse response) throws IOException {

        PrintWriter writer = response.getWriter();
        writer.write("测试");

//        ServletOutputStream outputStream = response.getOutputStream();
//        outputStream.write();

    }


}
